package gui.objects;

import java.awt.Color;
import java.awt.Graphics;

import framework.events.Event;
import framework.gui.GUIObject;
import framework.layer.physical.position.ContinuousPosition;

public class GUIPheromoneDrop extends GUIObject {

	private final static int radius = 3;
	private final static int diameter = 2 * radius;

	private ContinuousPosition position;

	public GUIPheromoneDrop(ContinuousPosition position) {
		super(1);
		this.position = position;
	}

	public ContinuousPosition getPosition() {
		if (position == null) {
			throw new IllegalStateException();
		}
		return position;
	}

	@Override
	protected void drawProtected(Graphics g) {
		g.setColor(Color.blue);
		g.drawOval(convertX(getPosition().getX()) - radius, convertY(getPosition().getY()) - radius, diameter, diameter);
		g.setColor(Color.black);
	}

	@Override
	public boolean isConnectedOk() {
		return hasPosition();
	}

	public boolean hasPosition() {
		return position != null;
	}

	@Override
	public void registerEvents() {
		
	}

	@Override
	public void handleEvent(Event event) {
	}
}
